Directory (Apache Ant API)

org.apache.tools.ant.taskdefs.optional.ssh

## Class Directory

- java.lang.Object
- - org.apache.tools.ant.taskdefs.optional.ssh.Directory

-     public class Directory
      extends java.lang.Object

  A helper object for Scp representing a directory in a file system.

- - ### Constructor Summary

    Constructors
    Constructor and Description
    `Directory(java.io.File directory)` Constructor for a Directory.
    `Directory(java.io.File directory, Directory parent)` Constructor for a Directory.

  - ### Method Summary

    Methods
    Modifier and Type | Method and Description
    --- | ---
    `void` | `addDirectory(Directory directory)` Add a directory to the child directories.
    `void` | `addFile(java.io.File file)` Add a file to the list of files.
    `java.util.Iterator` | `directoryIterator()` Get an iterator over the child Directories.
    `boolean` | `equals(java.lang.Object obj)` The equality method.
    `java.util.Iterator` | `filesIterator()` Get an iterator over the files.
    `int` | `fileSize()` Get the number of files in the files attribute.
    `Directory` | `getChild(java.io.File dir)` Get a child directory of this directory.
    `java.io.File` | `getDirectory()` Get the directory file.
    `Directory` | `getParent()` Get the parent Directory.
    `java.lang.String[]` | `getPath()` Get the path components of this directory.
    `static java.lang.String[]` | `getPath(java.lang.String thePath)` Convert a file path to an array of path components.
    `int` | `hashCode()` The hashcode method.
    `boolean` | `isRoot()` Is this a root Directory?

    - ### Methods inherited from class java.lang.Object

      `clone, finalize, getClass, notify, notifyAll, toString, wait, wait, wait`

- - ### Constructor Detail

    - #### Directory

          public Directory(java.io.File directory)

      Constructor for a Directory.
      Parameters:
        `directory` - a directory.

    - #### Directory

          public Directory(java.io.File directory,
                   Directory parent)

      Constructor for a Directory.
      Parameters:
        `directory` - a directory
        `parent` - a parent Directory

  - ### Method Detail

    - #### addDirectory

          public void addDirectory(Directory directory)

      Add a directory to the child directories.
      Parameters:
        `directory` - a Directory

    - #### addFile

          public void addFile(java.io.File file)

      Add a file to the list of files.
      Parameters:
        `file` - a file to add

    - #### directoryIterator

          public java.util.Iterator directoryIterator()

      Get an iterator over the child Directories.
      Returns:
        an iterator

    - #### filesIterator

          public java.util.Iterator filesIterator()

      Get an iterator over the files.
      Returns:
        an iterator

    - #### getParent

          public Directory getParent()

      Get the parent Directory.
      Returns:
        the parent Directory.

    - #### isRoot

          public boolean isRoot()

      Is this a root Directory?
      Returns:
        true if there is no parent Directory

    - #### getDirectory

          public java.io.File getDirectory()

      Get the directory file.
      Returns:
        the directory file

    - #### getChild

          public Directory getChild(java.io.File dir)

      Get a child directory of this directory.
      Parameters:
        `dir` - the directory to look for
      Returns:
        the child directory, or null if not found

    - #### equals

          public boolean equals(java.lang.Object obj)

      The equality method. This checks if the directory field is the same.
      Overrides:
        `equals` in class `java.lang.Object`
      Parameters:
        `obj` - the object to compare to
      Returns:
        true if this object has an equal directory field as the other object

    - #### hashCode

          public int hashCode()

      The hashcode method.
      Overrides:
        `hashCode` in class `java.lang.Object`
      Returns:
        the hash code of the directory field

    - #### getPath

          public java.lang.String[] getPath()

      Get the path components of this directory.
      Returns:
        the path components as an array of strings.

    - #### getPath

          public static java.lang.String[] getPath(java.lang.String thePath)

      Convert a file path to an array of path components. This uses File.separator to split the file path string.
      Parameters:
        `thePath` - the file path string to convert
      Returns:
        an array of path components

    - #### fileSize

          public int fileSize()

      Get the number of files in the files attribute.
      Returns:
        the number of files